import request from '@/utils/request'

// 创建销售单
export function createSaleOrder(data) {
  return request({
    url: '/pekingfish/sale-order/create',
    method: 'post',
    data: data
  })
}

// 更新销售单
export function updateSaleOrder(data) {
  return request({
    url: '/pekingfish/sale-order/update',
    method: 'put',
    data: data
  })
}

// 删除销售单
export function deleteSaleOrder(id) {
  return request({
    url: '/pekingfish/sale-order/delete?id=' + id,
    method: 'delete'
  })
}

// 获得销售单
export function getSaleOrder(id) {
  return request({
    url: '/pekingfish/sale-order/get?id=' + id,
    method: 'get'
  })
}

// 获得销售单分页
export function getSaleOrderPage(query) {
  return request({
    url: '/pekingfish/sale-order/saleOrderPageList',
    method: 'get',
    params: query
  })
}

// 导出销售单 Excel
export function exportSaleOrderExcel(query) {
  return request({
    url: '/pekingfish/sale-order/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

export function saleOrderInboud(id) {
  return request({
    url: '/pekingfish/sale-order/saleOrderInboud?id=' + id,
    method: 'post'
  })
}

